<html>
<head>
	<?php $this->load->view('config/head');?>
	<script type="text/javascript">
		var group_id = <?php echo @$detail[0]['jenis_image']?>
	
		$(document).ready(function(){
			if(group_id){
				if(group_id == 3){
					$("#advanceSet").show();
				}else{
					$("#advanceSet").hide();
				}
			}else{
				$("#advanceSet").hide();
			}
		});
		
		function getNilai(v){
			if(v == 3 || group_id == 3){
				$("#advanceSet").show();
			}else{
				$("#advanceSet").hide();
			}
		}
    </script>
</head>
<body>
	<?php $this->load->view('config/awal_body');?>
	
	<h3><?php echo $mode?> image</h3>
	<a href="<?php echo site_url()?>mg_image/index" class="btn">List image</a>
	<br/>
	<br/>
	<form method="post" action="<?php echo site_url() ?>mg_image/<?php echo $action?>" class="form-horizontal" enctype="multipart/form-data">
		<input type="hidden" name="id_image" value="<?php echo @$detail[0]['id_image']?>" />
		<input type="hidden" name="upload_image_tmp" value="<?php echo @$detail[0]['upload_image_tmp']?>" />
		<div class="control-group">
			<label class="control-label" for="menu">Place image</label>
			<div class="controls">
				<select name="jenis_image" onChange="getNilai(this.value)">
					<?php if (@$detail[0]['jenis_image'] == 1):?>
						<?php $selected1 =  'selected="selected"' ?>
					<?php elseif (@$detail[0]['jenis_image'] == 2) :?>
						<?php $selected2 =  'selected="selected"' ?>
					<?php elseif (@$detail[0]['jenis_image'] == 3) :?>
						<?php $selected3 =  'selected="selected"' ?>
					<?php else:?>
						<?php $selected1 =  '' ?>
						<?php $selected2 =  '' ?>
						<?php $selected3 =  '' ?>
					<?php endif;?>
				
				
					<option value="1" <?php echo $selected1 ?> >Logo</option>
					<option value="2" <?php echo $selected2 ?> >Slide Show</option>
					<option value="3" <?php echo $selected3 ?> >Galery</option>
				</select>
			</div>
		</div>
		
		<div id="advanceSet">
			<div class="control-group">
				<label class="control-label" for="id_menu">Menu</label>
				<div class="controls">
					<select name="id_menu">
						<option value="0">Pilih menu</option>
						<?php if (@$set):?>
							<?php foreach ($set as $row):?>
								<?php if($row['id_menu'] == @$detail[0]['id_menu']):?>
									<?php $selected =  'selected="selected"' ?>
								<?php else:?>
									<?php $selected =  '' ?>
								<?php endif;?>
								<option value="<?php echo $row['id_menu'] ?>" <?php echo $selected ?> ><?php echo $row['nama_menu'] ?></option>
							<?php endforeach?>
						<?php endif?>
					</select>
				</div>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="deskripsi_image">Description</label>
			<div class="controls">
				<textarea name="deskripsi_image" class="span7"><?php echo @$detail[0]['deskripsi_image']?></textarea>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="upload_image">Image *</label>
			<div class="controls">
				<?php if(@$detail[0]['upload_image'] == "" ):?>
					<input type="file" name="upload_image" value="<?php echo @$detail[0]['upload_image']?>" ></input>
				<?php else:?>
					<input type="text" name="upload_image" class="span7" value="<?php echo @$detail[0]['upload_image']?>" readonly="readonly"/>
				<?php endif;?>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="button">&nbsp;</label>
			<div class="controls">
				<input type="submit" name="submit" value="Save" class="btn btn-primary" />
				<input type="reset" value="Reset" class="btn" />
			</div>
		</div>
		<div>
			<i><b>*Logo</b> : ukuran file max 1024x150 pixel <br/> <b>*Slide</b> : ukuran file max 960x300 pixel <br/> <b>*Galery</b> : ukuran file max 1024x800 pixel</i>
		</div>
	</form>
	
	<?php $this->load->view('config/akhir_body');?>
</body>
</html>

